package com.cooge.sharevideo.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.cooge.sharevideo.base.BaseController;
import com.cooge.sharevideo.util.EncodingUtil;
import com.cooge.sharevideo.util.PageInfo;
import com.cooge.sharevideo.web.pojo.Video;
import com.cooge.sharevideo.web.service.VideoService;
@Controller
@RequestMapping("search_video")
public class SouViewController  extends BaseController{
	
	@Autowired
	VideoService videoService;
	
	@RequestMapping(value = "s_{key}.html",method=RequestMethod.GET)
	public ModelAndView sousuo_view(Model model,@PathVariable String key,PageInfo<Video>  p){
		key = EncodingUtil.getCharacter(key);
		ModelAndView mav = new ModelAndView("search_video/sousuo");
		Video v = new Video();
		v.setTitle(key);
		v.setIntroduction(key);
		p.setT(v);
		p= videoService.findPage(p);
		mav.addObject("p",p);
		return mav;
	}

}
